package com.lmx.repoDomain.tmodel;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToMany;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

/**
 * 员工考核抽查项
 *
 * @author ytche
 * @date 2017年9月5日
 *
 */
@Entity
@Table(name = "tnb_temp_assessment_indicators")
@JsonApiResource(type = "tempAssessmentIndicators")
public class TempAssessmentIndicators extends BaseEntity {
	private static final long serialVersionUID = 1L;
	private Integer assessmentDate;
	private Set<AssessmentIndicator> indicators;

	@Column(name = "assessment_date")
	public Integer getAssessmentDate() {
		return assessmentDate;
	}

	public void setAssessmentDate(Integer assessmentDate) {
		this.assessmentDate = assessmentDate;
	}

	@ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinTable(name = "rel_temp_assessment_indicator", joinColumns = { @JoinColumn(name = "temp_ass_id") },
			inverseJoinColumns = { @JoinColumn(name = "indicator_id") })
	@JsonApiToMany
	@JsonApiIncludeByDefault
	public Set<AssessmentIndicator> getIndicators() {
		return indicators;
	}

	public void setIndicators(Set<AssessmentIndicator> indicators) {
		this.indicators = indicators;
	}
}
